package com.manhhavu.bemas.agents.jadeimpl;

import java.util.Date;
import java.util.List;

import com.manhhavu.bemas.business.objects.link.ClickedLink;
import com.manhhavu.bemas.dao.ClickedLinkDAO;
import com.manhhavu.bemas.dao.hibernateimpl.ClickedLinkDAOHibernateImpl;
import com.manhhavu.bemas.utils.DateUtils;

import jade.core.Agent;

public class LinkAnalyser extends Agent {
	
	@Override
	public void setup() {
		ClickedLinkDAO dao = new ClickedLinkDAOHibernateImpl();
		
		List<ClickedLink> links = dao.getAll();
		
		ClickedLink link = new ClickedLink();
		link.setClickedTime(DateUtils.now());
		link.setLink("http://tinphap.info");
		link.setSessionId("KJIHU6H5KJH23KJ5H4K");
		link.setSource("http://manhhavu.com");
		link.setUserId("0760340389");
		link.setLastModified(System.currentTimeMillis());
		
		dao.save(link);
		System.out.println("Link " + link.getId() + " has been saved at " + link.getClickedTime().getHours());
		
		
		//for(ClickedLink l : links) {
		//	System.out.println(l.getLink());
		//}
	}
}
